<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
</head>
<body>
    <div>
        <p><span id="count">3</span>秒后页面将自动关闭</p>
    </div>
<?php


//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
$nowpageid      = addslashes($_REQUEST['nowpageid']);
$sortby         = addslashes($_REQUEST['sortby']);
$term_nid       = addslashes($_REQUEST['term_nid']);


//设置任务的mid
$maxmen=select_one_line_all_items($table_Prefix."task","mid != 'admin' order by mid desc");
$_REQUEST['ai_mid']=$maxmen['mid']+1;


//设置需要搜索的表格的前缀后缀
$table = $table_Prefix . "task";
//设置需要搜索的表格的前缀后缀

$path = ROOT_PATH_."/uploadfiles/";
$_REQUEST['ai_note'] = replace_base64_with_image($_REQUEST['ai_note'],$path);

$sql=insert_date($table,$_REQUEST);
$query = mysql_query($sql) or die (mysql_error().$sql);
mysql_close($con);






//通知执行人，有新的任务。内部触发发送信息，不再使用file get contents 或者sock，因为不稳定
$_principal=select_one_line_all_items($table_Prefix."employee","nid='".$_REQUEST['ai_principal']."'");
///print_r2($_principal);
$openid=$_principal['openid'];
// include_once ROOT_PATH_."/api/wechat_message/notice_task_created.php" ;


?>

</body>

<script>
    layer.alert('信息已保存', {
        time: 3*1000
        ,success: function(layero, index){
            var timeNum = this.time/1000, setText = function(start){
                layer.title((start ? timeNum : --timeNum) + ' 秒后关闭', index);
            };
            setText(!0);
            this.timer = setInterval(setText, 1000);
            if(timeNum <= 0) clearInterval(this.timer);
            //if(timeNum <= 0) layer.closeAll();
        }
        ,end: function(){
            clearInterval(this.timer);
            window.parent.location.reload();
        }
    });
</script>